<template>
  <div class="app-container">
    <el-tabs type="card" @tab-click="handleClick" v-model="activeName">
      <el-tab-pane label="设定地震" name="first">
        <div style="position: relative;top:0px;left:0px;width:100%;height:800px;">
          <Index v-if="completeRefreshAssess" @showDetailMap="showDetailMap"></Index>
        </div>
      </el-tab-pane>
      <el-tab-pane label="评估列表" name="second">
        <el-form :model="queryParams" ref="queryRef" :inline="true" label-width="100px">
          <el-form-item label="震级" prop="earthQuakeLevel">
            <el-input placeholder="震级" v-model="queryParams.earthQuakeLevel" clearable @keyup.enter="handleQuery" />
          </el-form-item>

          <el-form-item label="省" prop="province">
            <el-select v-model="queryParams.province" placeholder="请选择省" @change="chooseProvince" clearable
              value-key="id">
              <el-option v-for="item in provinceData" :key="item.id" :label="item.name" :value="item.id">
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="市" prop="city">
            <el-select v-model="queryParams.city" placeholder="请选择市" @change="chooseCity" clearable value-key="id">
              <el-option v-for="item in cityData" :key="item.id" :label="item.name" :value="item.id">
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="区/县" prop="area">
            <el-select v-model="queryParams.area" placeholder="请选择县" @change="choosearea" clearable value-key="id">
              <el-option v-for="item in areaData" :key="item.id" :label="item.name" :value="item.id">
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="断层性质" prop="faultProperties">
            <el-select v-model="queryParams.faultProperties" placeholder="请选择" clearable @keyup.enter="handleQuery">
              <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" />
            </el-select>
          </el-form-item>
          <el-form-item>
            <el-button type="primary" @click="handleQuery">查询</el-button>
            <el-button @click="resetQuery">重置</el-button>
          </el-form-item>
        </el-form>

        <el-row :gutter="10" class="mb8">
          <el-col :span="1.5">
            <el-button plain icon="Delete" :disabled="multiple" @click="handleDelete">删除</el-button>
            <!-- <el-button type="primary" @click="handleImport()">导入</el-button> -->
          </el-col>
        </el-row>
        <!-- container表格区域 -->
        <el-table :data="listData" v-loading="loading" row-key="dtId" ref="tableRef" stripe
          @selection-change="handleSelectionChange">
          <el-table-column type="selection" width="55" align="center" :reserve-selection="true" />
          <el-table-column label="编号" align="center" prop="num" />

          <el-table-column label="经度" align="center" prop="longitude" />
          <el-table-column label="纬度" align="center" prop="latitude" />
          <el-table-column label="震级" align="center" prop="earthQuakeLevel" />
          <el-table-column label="震源深度（km）" align="center" prop="sourceDepth" />
          <el-table-column label="断层性质" align="center" prop="faultProperties">
            <template #default="scope">
              <div v-if="scope.row.faultProperties == '0'">走滑断层</div>
              <div v-if="scope.row.faultProperties == '1'">逆断层</div>
              <div v-if="scope.row.faultProperties == '2'">正断层</div>
              <div v-if="scope.row.faultProperties == '3'">正走滑</div>
              <div v-if="scope.row.faultProperties == '4'">逆走滑</div>
            </template>
          </el-table-column>
          <el-table-column label="活断层数据版本" align="center" prop="faultVersion" />
          <el-table-column label="地区" align="center" prop="district" />
          <el-table-column label="评估人" align="center" prop="evaluateUserName" />
          <el-table-column label="评估时间" align="center" prop="evaluateTime" width="160px" />
          <el-table-column label="操作" align="center" width="200px" class-name="small-padding fixed-width">
            <template #default="scope">
              <!--<el-button type="text"  @click="update(scope.row)">查看结果</el-button>-->
              <el-button type="text" @click="showDetailMap(scope.row)">查看结果</el-button>
            </template>
          </el-table-column>
        </el-table>
        <pagination v-show="total > 0" :total="total" v-model:page="queryParams.page" v-model:limit="queryParams.rows"
          @pagination="getList" />
      </el-tab-pane>
    </el-tabs>
    <!--查看/修改任务的弹出框 -->
    <el-dialog v-model="openAdd" :title="title" width="800px" append-to-body>
      <p class="dialogTitle">{{ title }}</p>
      <table class="addAssess">
        <div v-if="title != '修改任务'">
          <el-form :model="queryParamsAdd" :rules="rules" ref="rulesFormAdd" :inline="true" label-width="140px">
            <el-row>
              <el-form-item>
                <span class="label">任务编号：</span><span>{{ queryParamsAdd.AssessNum }}</span>
              </el-form-item>
            </el-row>
            <el-row>
              <el-form-item>
                <span class="label">任务名称：</span><span>{{ queryParamsAdd.AssessName }}</span>
              </el-form-item>
            </el-row>

          </el-form>
        </div>
        <tr v-if="title == '修改任务'">
          <td>
            <span class="label">任务编号：</span><span>{{ queryParamsAdd.AssessNum }}</span>
          </td>
        </tr>
        <tr v-if="title == '修改任务'">
          <td colspan="2">
            <el-form :model="queryParamsAdd" :rules="rules" ref="rulesFormAdd" :inline="true" label-width="140px">
              <el-form-item label="任务名称：" prop="AssessName" style="width: 90%">
                <el-input placeholder="请输入任务名称" clearable v-model="queryParamsAdd.AssessName" />
              </el-form-item>
            </el-form>
          </td>
        </tr>
        <tr>
          <td colspan="2">
            <span class="label">面积（平方公里）：</span><span>{{ queryParamsAdd.area }}</span>
          </td>
        </tr>
        <tr>
          <td colspan="2">
            <span class="label">任务区域：</span><span class="init-AssessDivSpan">{{ queryParamsAdd.AssessRegion.substr(0, 358)
            }}</span>
          </td>
        </tr>
        <tr>
          <td colspan="2">
            <span class="label">任务地区：</span><span class="init-AssessDivSpan" v-if="title == '新建任务'">{{ AssessDistrictName
            }}</span><span class="init-AssessDivSpan" v-else>{{
  queryParamsAdd.AssessDistrict
}}</span>
          </td>
        </tr>
        <!--<tr>
          <td colspan="2">
            <span class="label">承担小组：</span><span>{{ queryParamsAdd.groupName }}</span><el-button style="margin-left:20px" @click="fenPeiAdd">修改分配</el-button>
          </td>
        </tr>-->
        <tr>
          <td colspan="2">
            <el-form :model="queryParamsAdd" :inline="true" label-width="140px">
              <el-form-item label="灾害类型：" prop="disasterType" style="width: 90%">
                <el-checkbox-group v-model="queryParamsAdd.disasterType">
                  <el-checkbox label="1" :disabled="dzhpIsEdit">地震滑坡</el-checkbox>
                  <el-checkbox label="2" :disabled="styhIsEdit">砂土液化</el-checkbox>
                  <el-checkbox label="3" :disabled="rtzxIsEdit">软土震陷</el-checkbox>
                </el-checkbox-group>
              </el-form-item>
            </el-form>

          </td>
        </tr>
        <tr>
          <td colspan="2">
            <span class="label">评估人：</span><span>{{ queryParamsAdd.createUserName }}</span>
          </td>
        </tr>
        <tr>
          <td colspan="2">
            <span class="label">任务状态：</span>
            <span v-if="queryParamsAdd.AssessStatus == '1'">进行中</span>
            <span v-if="queryParamsAdd.AssessStatus == '2'">审核中</span>
            <span v-if="queryParamsAdd.AssessStatus == '3'">退回修改</span>
            <span v-if="queryParamsAdd.AssessStatus == '4'">已完成</span>
          </td>
        </tr>
      </table>

      <template #footer>
        <span class="dialog-footer">

          <el-button v-if="title == '修改任务'" type="primary" @click="okAdd">保 存</el-button>

          <el-button @click="cancelAdd">取 消</el-button>

        </span>
      </template>
    </el-dialog>

		<!-- 导入对话框 -->
		<el-dialog :title="upload.title" v-model="upload.open" width="400px" append-to-body>
			<p></p>
			<el-upload ref="uploadRef" :limit="1" accept=".xlsx, .xls" :headers="upload.headers" :action="upload.url" :disabled="upload.isUploading" :before-upload="handleFileBeforeUpload" :on-progress="handleFileUploadProgress" :on-error="handleFileUploadError" :on-success="handleFileSuccess" :auto-upload="false" :data="dataFile" drag>
				<el-icon class="el-icon--upload">
					<upload-filled />
				</el-icon>
				<div class="el-upload__text">将文件拖到此处，或<em>点击上传</em></div>
				<template #tip>
					<div class="el-upload__tip text-center">
						<span>仅允许导入xls、xlsx格式文件。</span>
						<el-link type="primary" :underline="false" style="font-size:12px;vertical-align: baseline;" @click="importTemplate('地表破裂带导入.xlsx')">下载模板</el-link>
					</div>
				</template>
			</el-upload>
			<template #footer>
				<div class="dialog-footer">
					<el-button type="primary" @click="submitFileForm">确 定</el-button>
					<el-button plain @click="upload.open = false">取 消</el-button>
				</div>
			</template>
		</el-dialog>
  </div>
</template>
<script setup name="ruptureZoneAssess">
//地图
import Index from '@/map/ruptureZoneAssess/index.vue';
//地图空间分析
//import {getSubAssessRegionIntersection} from "@/map/ruptureZoneAssess/sceneexamine/mapUtil.js";
import { hasEvaluateResult } from '@/api/ruptureZoneAssess/indexMap.js';

import { getProvince, getChildArea } from "@/api/system/division";
import { getProvinces, getYear, getDistrict } from "@/utils/group.js";
import {
  getAssess,
  delAssess,
  updateAssess,
  addSubAssess,
  addAssess,
  detailAssess,
  getAllAssessList
} from "@/api/ruptureZoneAssess/assess";
import { getAreaTree, getDistrictBoundary } from "@/api/ruptureZoneAssess/sceneExame"
import { getToken } from "@/utils/auth";
const { proxy } = getCurrentInstance();
const router = useRouter();
const AssessDistrictName = ref("");
const checkedAreaRef = ref();
const props = { multiple: true };
const ids = ref([]);
const single = ref(true);
const multiple = ref(true);
const dzhpIsEdit = ref(false);
const styhIsEdit = ref(false);
const rtzxIsEdit = ref(false);
const options = [
  {
    value: "0",
    label: "走滑断层",
  },
  {
    value: "1",
    label: "逆断层",
  },
  {
    value: "2",
    label: "正断层",
  },
  {
    value: "3",
    label: "正走滑",
  },
  {
    value: "4",
    label: "逆走滑",
  },
];
const newYear = getYear();
const optionsYear = [
  {
    value: String(newYear),
    label: String(newYear),
    id: 1,
  },
  {
    value: String(newYear + 1),
    label: String(newYear + 1),
    id: 2,
  },
  {
    value: String(newYear + 2),
    label: String(newYear + 2),
    id: 3,
  },
];
const loading = ref(true);
const loading1 = ref(true);
const provinceData = ref([]); //省
const cityData = ref([]); //市
const areaData = ref([]); //区、县
const openFp = ref(false);
const fpId = ref({
  id: undefined,
  parentId: undefined,
  AssessName: undefined,
  createUser:undefined
});
const openAdd = ref(false);
const openAddSub = ref(false);
const openArea = ref(false);
const title = ref("");
const titleSub = ref("");
const activeName = ref("first");
const queryGroupObj = ref(undefined);
const openDetail = ref(false);
const total = ref(0);
const num = ref();
const parentAssessCode = ref();
const parentAssessYear = ref();
const parentAssessId = ref();
const numAdd = ref(2);
const districtListName = ref("");
const delFlag = ref(false);
const rules = reactive({
  AssessDistrict: [{ required: true, message: "请选择地区", trigger: "change" }],
  AssessYear: [{ required: true, message: "请选择年份", trigger: "change" }],
  AssessName: [{ required: true, message: "请输入任务名称", trigger: "blur" }],
});
const rules2 = reactive({
  AssessName: [{ required: true, message: "请输入任务名称", trigger: "blur" }],
  subdistrictList: [
    { required: true, message: "请输入选择省份", trigger: "blur" },
  ],
});
let detilList = reactive({
  preAssessAssessEntity: {
    AssessYear: undefined,
    AssessNum: undefined,
    AssessName: undefined,
    AssessArea: undefined,
    AssessRegion: undefined,
    districtList: undefined,
    groupName: undefined,
    groupLeader: undefined,
    AssessDistrict: undefined,
  },
  expertlist: undefined,
  memberlist: "",
});
const data = reactive({
  form: {
    AssessDistrict: "",
  },
  selectProvince: [],
  listData: [],
  queryParams: {
    page: 1,
    rows: 10,
    earthQuakeLevel: "",
    faultProperties: "",
    province: "",
    city: "",
    area: "",
  },
  queryParamsAdd: {
    AssessYear: "",
    AssessNum: "",
    AssessName: "",
    AssessArea: "",
    AssessRegion: "",
    parentdistrictList: [],
    AssessDistrict: "",
    groupName: "",
    groupLeader: "",
    groupId: "",
    groupLeaderId: "",
    regionCodes:""//地图行政区划code,code字符串
  },
  queryParamsSubAdd: {
    AssessYear: "",
    AssessNum: "",
    AssessName: "",
    AssessArea: "",
    AssessRegion: "",
    subdistrictList: "",
    AssessDistrict: "",
    groupName: "",
    groupLeader: "",
    groupLeaderId: "",
    groupId: "",
    regionCodes:""//地图行政区划code,code字符串
  },
  subAssessData: [],
  subDataPage: {
    page: 1,
    rows: 10,
  },
  optionsSelect: [],
  selectArea: [],
});

let {
  form,
  queryParams,
  listData,
  queryParamsAdd,
  queryParamsSubAdd,
  selectArea,
  subAssessData,
  optionsSelect,
} = toRefs(data);

//地图传参--start
const completeRefreshAssess = ref(false);//防止刷新后地图不显示
const allListData = ref([]);
const isSaveMapPolygon = ref(false);//判断是否完成保存任务区域
const xzqhSelect = ()=>{//行政区划选择区域
  areaSelect();
}
const mapNewAssess = (temp)=>{//新建任务
  isSaveMapPolygon.value = false;//判断是否完成保存任务区域
  getAssessNum();
  subAssessData.value = [];
  title.value = "新建任务";
  num.value = 0;
  openAdd.value = true;
  resetAdd();
  queryParamsAdd.value.AssessArea = temp.AssessArea;
  queryParamsAdd.value.AssessRegion = temp.AssessRegion;
  queryParamsAdd.value.parentdistrictList = temp.parentdistrictList;
  queryParamsAdd.value.regionCodes = "";//地图行政区划code,code字符串
  console.log(temp.parentdistrictList);
  AssessDistrictName.value = temp.parentdistrictList.join(',');
  districtListName.value = getMapProvinces(AssessDistrictName.value);
}
const mapUpdAssess = (row)=>{//修改任务
  updateParentHandle(row);
}
const mapDelAssess = (row)=>{//删除任务
  delSubAssess(row);
}
const mapLoading = (msg)=>{//地图查询loading
  if(msg!=null){
    proxy.$modal.loading(msg);
  }else{
    proxy.$modal.closeLoading();
  }
}
const mapShowAssess = (id)=>{//查看任务
  handleDetil(id);
}
//处理地图圈选省份
function getMapProvinces(AssessDistrict){
  const str = AssessDistrict.replace(/-/g, ",")
  const arr =  [...new Set(str.split(","))]
  let newArr = []
  arr.forEach(item=>{
    if(item.indexOf('省')!=-1){
      newArr.push(item)
    }else if (item=='北京市'||item == '天津市'||item=='上海市'||item=='重庆市'||item=='内蒙古自治区'||item=='内蒙古自治区'||item=='广西壮族自治区'||item=='西藏自治区'||item=='宁夏回族自治区'||item=='新疆维吾尔自治区'||item=='香港特别行政区'||item=='澳门特别行政区') {
      newArr.push(item)
    }
  })
  let brr =[]
  brr =  newArr.map(
      (item, index) => {
        return Object.assign({}, { value: item, label: item, id: index + 1 });
      }
  );
  return brr
}
//获取行政区划总面积
function getAllSelectArea(array) {
  let areaCount = 0;
  if (array != null && array.length > 0) {
    for (let i = 0; i < array.length; i++) {
      let name = array[i];
      let arr = name.split('-');
      if (arr.length == 1) {//省
        let province = arr[0];
        let areaTemp = getAreaByAllName("1", province, null, null);//根据行政区划全称获取省市区面积信息
        areaCount += areaTemp;
      } else if (arr.length == 2) {//市或直辖市的区县
        let province = arr[0];
        let city = arr[1];
        let areaTemp = getAreaByAllName("2", province, city, null);//根据行政区划全称获取省市区面积信息
        areaCount += areaTemp;
      } else if (arr.length == 3) {//区县
        let province = arr[0];
        let city = arr[1];
        let area = arr[2];
        let areaTemp = getAreaByAllName("3", province, city, area);//根据行政区划全称获取省市区面积信息
        areaCount += areaTemp;
      }
    }
  }
  if (areaCount > 0) {
    areaCount = areaCount.toFixed(3);//四舍五入保留3位小数
  }

  return areaCount;
}
function getAreaByAllName(type, province, city, area) {//根据行政区划全称获取省市区面积信息
  //type:0省 | 1市 | 2区县
  let areaCount = 0;
  let districtTreeDataList = districtTreeList.value;
  if (districtTreeDataList != null && districtTreeDataList != "") {
    //获取行政区划树列表
    let treeList = districtTreeDataList;
    if (treeList != null && treeList.length > 0) {
      for (let i = 0; i < treeList.length; i++) {
        let provinceData = treeList[i];//省节点
        if (provinceData != null) {
          let provinceName = provinceData.name;//省
          if (type == "1" && province == provinceName) {
            let cityList = provinceData.children;//市列表
            if (cityList != null) {
              for (let j = 0; j < cityList.length; j++) {
                let cityData = cityList[j];
                if (cityData != null) {
                  let areaList = cityData.children;//区县列表
                  if (areaList != null && areaList.length > 0) {
                    for (let j = 0; j < areaList.length; j++) {
                      let areaData = areaList[j];
                      if (areaData != null) {
                        areaCount += areaData.area / 1000000;//平方公里
                      }
                    }
                  } else {//直辖市
                    areaCount += cityData.area / 1000000;//平方公里
                  }
                }
              }
            }
            return areaCount;
          }
          let cityList = provinceData.children;//市列表
          if (cityList != null) {
            for (let j = 0; j < cityList.length; j++) {
              let cityData = cityList[j];
              if (cityData != null) {
                let cityName = cityData.name;//市
                if (type == "2" && city == cityName) {
                  let areaList = cityData.children;//区县列表
                  if (areaList.length > 0) {
                    for (let j = 0; j < areaList.length; j++) {
                      let areaData = areaList[j];
                      if (areaData != null) {
                        areaCount += areaData.area / 1000000;//平方公里
                      }
                    }
                  } else {//直辖市的区县
                    areaCount = cityData.area / 1000000;//平方公里
                  }
                  return areaCount;
                }
                let areaList = cityData.children;//区县列表
                if (areaList != null) {
                  for (let j = 0; j < areaList.length; j++) {
                    let areaData = areaList[j];
                    if (areaData != null) {
                      let areaName = areaData.name;//区县
                      if (type == "3" && area == areaName) {
                        areaCount += areaData.area / 1000000;//平方公里
                        return areaCount;
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }

  return areaCount;
}
//查询行政区划树列表
const districtTreeList = ref([]);
const districtBoundaryList = ref([]);//行政区划经纬度信息
const districtCount = ref(0);//选择的行政区划数量
//查询行政区划经纬度信息
function getDistrictBoundaryByCode(codeList) {
  for (let m = 0; m < codeList.length; m++) {
    let code = codeList[m];
    //查询行政区划经纬度信息
    getDistrictBoundary(code).then((response) => {
      nextTick(() => {
        //districtBoundaryList.value.push(response.data.coordinate);
        //截取数据防止报错--仅用于展示不保存
        let subStr = response.data.coordinate;
        subStr = subStr.substring(0, 1000);
        districtBoundaryList.value.push(subStr);
        if (districtCount.value == districtBoundaryList.value.length) {//判断是否全部查询完毕
          let region = "";
          let list = districtBoundaryList.value;
          for (let i = 0; i < list.length; i++) {
            if (i > 0) {
              region += ";";
            }
            region += list[i];
          }
          queryParamsAdd.value.AssessRegion = region;
          //新建任务
          proxy.$refs["rulesForm"].validate((vaild) => {
            if (!vaild) {
              return;
            }
            getAssessNum();
            subAssessData.value = [];
            title.value = "新建任务";
            num.value = 0;
            openAdd.value = true;
            //地图获取行政区划总面积
            let area = getAllSelectArea(queryParamsAdd.value.parentdistrictList);
            queryParamsAdd.value.AssessArea = area.toString();
            proxy.$modal.closeLoading();
          });
        }
      });
    });
  }
}
//根据所有省市县全名字符串获取codelist
function getCodeByAllName(allName) {
  let allCodeList = [];
  if (allName != null && allName != "") {
    let array = allName.split("、");
    //获取行政区划树列表
    let treeList = districtTreeList.value;
    for (let i = 0; i < array.length; i++) {
      let name = array[i];
      let code = null;
      let arr = name.split('-');
      if (arr.length == 1) {//省或直辖市
        if (treeList != null && treeList.length > 0) {
          for (let i = 0; i < treeList.length; i++) {
            let provinceData = treeList[i];//省节点
            if (provinceData != null) {
              let provinceName = provinceData.name;//省
              if (name == provinceName) {
                let provinceCode = provinceData.code;//省编码
                code = provinceCode;
                break;
              }
            }
          }
        }
      } else if (arr.length == 2) {//市或直辖市的区县
        if (treeList != null && treeList.length > 0) {
          for (let i = 0; i < treeList.length; i++) {
            let provinceData = treeList[i];//省节点
            if (provinceData != null) {
              let provinceName = provinceData.name;//省
              if (arr[0] == provinceName) {
                let bool = false;
                let cityList = provinceData.children;//市列表
                if (cityList != null) {
                  for (let j = 0; j < cityList.length; j++) {
                    let cityData = cityList[j];
                    if (cityData != null) {
                      let cityName = cityData.name;//市
                      if (arr[1] == cityName) {
                        let cityCode = cityData.code;//市编码
                        code = cityCode;
                        bool = true;
                        break;
                      }
                    }
                  }
                }
                if (bool) {
                  break;
                }
              }
            }
          }
        }
      } else if (arr.length == 3) {//区县
        if (treeList != null && treeList.length > 0) {
          for (let i = 0; i < treeList.length; i++) {
            let provinceData = treeList[i];//省节点
            let bool = false;
            if (provinceData != null) {
              let provinceName = provinceData.name;//省
              if (arr[0] == provinceName) {
                let cityList = provinceData.children;//市列表
                if (cityList != null) {
                  for (let j = 0; j < cityList.length; j++) {
                    let cityData = cityList[j];
                    if (cityData != null) {
                      let cityName = cityData.name;//市
                      if (arr[1] == cityName) {
                        let areaList = cityData.children;//区县列表
                        if (areaList != null) {
                          for (let j = 0; j < areaList.length; j++) {
                            let areaData = areaList[j];
                            if (areaData != null) {
                              let areaName = areaData.name;//区县
                              if (arr[2] == areaName) {
                                let areaCode = areaData.code;//区县编码
                                code = areaCode;
                                bool = true;
                                break;
                              }
                            }
                          }
                        }
                        if (bool) {
                          break;
                        }
                      }
                    }
                  }
                }
              }
            }
            if (bool) {
              break;
            }
          }
        }
      }
      //添加code
      allCodeList.push(code);
    }
  }

  return allCodeList;
}

//获取新建子任务地图区域信息
function getSubAssessMapRegion(type) {
  //type:okSubAdd保存子任务|okSubAddNext保存并创建下一个子任务
  proxy.$modal.loading("正在保存，请稍候...");
  //地图获取行政区划总面积
  let area = getAllSelectArea([queryParamsSubAdd.value.subdistrictList]);
  queryParamsSubAdd.value.AssessArea = area.toString();
  let provinceName = queryParamsSubAdd.value.subdistrictList;//省名
  //根据所有省市县全名字符串获取codelist
  let codeList = getCodeByAllName(provinceName);
  //选择的行政区划数量
  districtCount.value = codeList.length;
  let regionCodes = "";
  for (let i = 0; i < codeList.length; i++) {
    let code = codeList[i];
    if (i > 0) {
      regionCodes += ",";
    }
    regionCodes += code;
  }
  districtBoundaryList.value = [];//清空行政区划经纬度
  if (queryParamsAdd.value.AssessRegion.indexOf("MULTIPOLYGON") == -1) {//地图圈选父任务
    queryParamsSubAdd.value.AssessRegion = queryParamsAdd.value.AssessRegion;
    queryParamsSubAdd.value.regionCodes = "";//清空
  } else {//行政区划选择父任务
    let parentRegionCodes = queryParamsAdd.value.regionCodes;
    console.log("父任务行政区划code" + parentRegionCodes + ",子任务选择省份" + regionCodes);
    let tempCode = regionCodes.substring(0, 2);//省份code保留2位
    let parentRegionCodeArray = parentRegionCodes.split(",");
    let childRegionCode = "";
    for (let i = 0; i < parentRegionCodeArray.length; i++) {
      let parentRegionCode = parentRegionCodeArray[i];
      if (parentRegionCode.indexOf(tempCode) == 0) {//省份相同2位
        if (childRegionCode != "") {
          childRegionCode += ",";
        }
        childRegionCode += parentRegionCode;
      }
    }
    queryParamsSubAdd.value.regionCodes = childRegionCode;//地图行政区划code,code字符串
  }
  //查询子任务行政区划经纬度信息
  for (let m = 0; m < codeList.length; m++) {
    let code = codeList[m];
    //查询行政区划经纬度信息
    getDistrictBoundary(code).then((response1) => {
      nextTick(() => {
        districtBoundaryList.value.push(response1.data.coordinate);
        if (districtCount.value == districtBoundaryList.value.length) {//判断是否全部查询完毕
          let region = "";
          let list = districtBoundaryList.value;
          for (let i = 0; i < list.length; i++) {
            if (i > 0) {
              region += ";";
            }
            region += list[i];
          }
          if (queryParamsAdd.value.AssessRegion.indexOf("MULTIPOLYGON") == -1) {//地图圈选父任务
            //获取子任务区域经纬度（地图圈选父任务与省份的交集）
            queryParamsSubAdd.value.AssessRegion = getSubAssessRegionIntersection(queryParamsAdd.value.AssessRegion, region);
          } else {//行政区划选择父任务
            //截取数据防止报错--仅用于展示不保存
            region = region.substring(0, 10000);
            queryParamsSubAdd.value.AssessRegion = region;
          }
          //queryParamsSubAdd.value.AssessDistrict = queryParamsSubAdd.value.subdistrictList;//任务区域-省份
          proxy.$modal.closeLoading();
          if (type == "okSubAdd") {//
            proxy.$refs["rulesFormSubAdd"].validate((vaild) => {
              if (!vaild) {
                return;
              }
              if (queryGroupObj.value) {
                queryParamsSubAdd.value.groupName = queryGroupObj.value.groupName;
                queryParamsSubAdd.value.groupLeader = queryGroupObj.value.groupLeader;
                queryParamsSubAdd.value.groupId = queryGroupObj.value.id;
                queryParamsSubAdd.value.groupLeaderId = queryGroupObj.value.groupLeaderId;
              }
              // 新增
              if (titleSub.value == "新建子任务") {
                if (numAdd.value == 1) {
                  addSubAssess({
                    ...queryParamsSubAdd.value,
                    subdistrictList: [queryParamsSubAdd.value.subdistrictList],
                    AssessYear: parentAssessYear.value,
                    parentAssess: parentAssessCode.value,
                    parentId: parentAssessId.value,
                    parentdistrictList: queryParamsAdd.value.parentdistrictList,
                  }).then((response) => {
                    openAddSub.value = false;
                    proxy.$modal.msgSuccess(response.data.message);
                    resetSubData();
                    getList();
                    queryGroupObj.value = undefined;
                    getSubList(parentAssessId.value);
                  });
                } else {
                  addAssess({
                    parentAssess: queryParamsAdd.value,
                    subAssess: {
                      ...queryParamsSubAdd.value,
                      subdistrictList: [queryParamsSubAdd.value.subdistrictList],
                      AssessYear: parentAssessYear.value,
                      parentAssess: parentAssessCode.value,
                    },
                  }).then((response) => {
                    proxy.$modal.msgSuccess("保存成功");
                    numAdd.value = 1;
                    openAddSub.value = false;
                    resetSubData();
                    getSubList(response.data.parentAssessId);
                    queryGroupObj.value = undefined;
                    parentAssessId.value = response.data.parentAssessId;
                    //地图传参
                    isSaveMapPolygon.value = true;
                  });
                }
              }
            });
          } else if (type == "okSubAddNext") {//保存并创建下一个子任务
            proxy.$refs["rulesFormSubAdd"].validate((vaild) => {
              if (!vaild) {
                return;
              }
              // 新增
              if (queryGroupObj.value) {
                queryParamsSubAdd.value.groupName = queryGroupObj.value.groupName;
                queryParamsSubAdd.value.groupLeader = queryGroupObj.value.groupLeader;
                queryParamsSubAdd.value.groupId = queryGroupObj.value.id;
                queryParamsSubAdd.value.groupLeaderId = queryGroupObj.value.groupLeaderId;
              }
              if (numAdd.value == 1) {
                addSubAssess({
                  ...queryParamsSubAdd.value,
                  subdistrictList: [queryParamsSubAdd.value.subdistrictList],
                  AssessYear: parentAssessYear.value,
                  parentAssess: parentAssessCode.value,
                  parentId: parentAssessId.value,
                  parentdistrictList: queryParamsAdd.value.parentdistrictList,
                }).then((response) => {
                  proxy.$modal.msgSuccess("保存成功");
                  getSubAssessNum(parentAssessCode.value);
                  resetSubData();
                  getList();
                  queryGroupObj.value = undefined;
                  getSubList(parentAssessId.value);
                });
              } else {
                addAssess({
                  parentAssess: queryParamsAdd.value,
                  subAssess: {
                    ...queryParamsSubAdd.value,
                    subdistrictList: [queryParamsSubAdd.value.subdistrictList],
                    AssessYear: parentAssessYear.value,
                    parentAssess: parentAssessCode.value,
                  },
                }).then((response) => {
                  proxy.$modal.msgSuccess("保存成功");
                  numAdd.value = 1;
                  getSubAssessNum(parentAssessCode.value);
                  resetSubData();
                  // rulesFormSubAdd.value.clearValidate();
                  getSubList(response.data.parentAssessId);
                  queryGroupObj.value = undefined;
                  parentAssessId.value = response.data.parentAssessId;
                  //地图传参
                  isSaveMapPolygon.value = true;
                });
              }
            });
          }
        }
      });
    });
  }
}
//地图传参--end


/*切换标签页*/
function handleClick(tab, event) {
  if (tab.index == 1) {
    openArea.value = false;
    resetArea();
    getList();
  } else {
    //隐藏地图
    completeRefreshAssess.value = false;
    //地图查询全部任务
    // getAllList();
    setTimeout(function () {
      completeRefreshAssess.value = true;//显示地图
    }, 200);
  }
}
/*** 导入参数 */
const upload = reactive({
	open: false,
	title: "",
	isUploading: false,
	headers: { token: "token " + getToken() },
	url: import.meta.env.VITE_APP_BASE_API + "/surfaceRupture/uploadExcel",
});

// 模板下载
function importTemplate(name) {
	proxy.download("/base/product/downloadTemplateExcel", {
		fileName: name
	}, name);
}

/** 提交上传文件 */
function submitFileForm() {
	proxy.$refs["uploadRef"].submit();
};

/** 打开导入表弹窗 */
function handleImport() {
	upload.title = "导入";
	upload.open = true;
}

/**文件上传前处理 */
function handleFileBeforeUpload(file) {
	proxy.$modal.loading("正在上传文件，请稍候...");
	return true
}

/**文件上传中处理 */
const handleFileUploadProgress = (event, file, fileList) => {
	upload.isUploading = true;
};
// 上传失败
function handleFileUploadError(err) {
	proxy.$modal.closeLoading();
	proxy.$modal.msgError("上传文件失败");
}
/** 文件上传成功处理 */
const handleFileSuccess = (response, file, fileList) => {
	upload.open = false;
	upload.isUploading = false;
	proxy.$modal.closeLoading();
	proxy.$refs["uploadRef"].handleRemove(file);
  if(response.code == 200){
    proxy.$modal.msgSuccess("导入成功");
  }
};
const handleSelectionChange = (selection) => {
  ids.value = selection.map((item) => item.dsrId);
  single.value = selection.length != 1;
  multiple.value = !selection.length;
  //	selection.forEach((item) => {
  //  if (item.AssessStatus == "3" || item.AssessStatus == "2") {
  //    delFlag.value = false;
  //  } else {
  //    delFlag.value = true;
  //  }
  //	});
};

/** 搜索按钮操作 */
function handleQuery() {
  queryParams.value.page = 1;
  getList();
}
/** 重置按钮操作 */
function resetQuery() {
  cityData.value = [];
  areaData.value = [];
  proxy.resetForm("queryRef");
  handleQuery();
}

/** 获取省列表 */
function getProvinceData() {
  getProvince().then((response) => {
    provinceData.value = response.data;
  });
}

function chooseProvince(value) {
  queryParams.value.city = null;
  queryParams.value.area = null;
  queryParams.value.province = value;
  cityData.value = [];
  areaData.value = [];
  getChildArea(value).then((response) => {
    cityData.value = response.data;
  });
  /*provinceData.value.map((item) => {
    //遍历数据
    if (item.id == value.id) {
      if (
        item.name == "北京市" ||
        item.name == "天津市" ||
        item.name == "上海市" ||
        item.name == "重庆市"
      ) {
        cityData.value.push(JSON.parse(JSON.stringify(item)));
      } else {
        getChildArea(value.id).then((response) => {
          cityData.value = response.data;
        });
      }
      return;
    }
  });*/
}

function chooseCity(value) {
  queryParams.value.city = value;
  queryParams.value.area = null;
  areaData.value = [];
  getChildArea(value).then((response) => {
    areaData.value = response.data;
  });
}

function choosearea(value) {
  queryParams.value.area = value;
}

// 部门  树形数据
// 处理数据
function disposeata(data) {
  data.forEach((item) => {
    item.label = item.name;
    item.key = item.id;
    item.children && disposeata(item.children);
  });
  return data;
}
function getTreeselect() {
  getAreaTree().then((response) => {
    nextTick(() => {
      optionsSelect.value = disposeata(JSON.parse(response.data));
      console.log("行政区划列表");
      //地图行政区划列表
      districtTreeList.value = optionsSelect.value;
      console.log(districtTreeList.value);
    });
  });
}

function getCheckedArea() {
  let AssessDistrict = checkedAreaRef.value.getCheckedNodes();
  AssessDistrict = AssessDistrict.filter(option => !(option.parent && option.parent.checked))
  queryParamsAdd.value.parentdistrictList = AssessDistrict.map((item, index) => {
    return item.pathLabels.join("-");
  });
  var arr = JSON.parse(JSON.stringify(queryParamsAdd.value.parentdistrictList));
  queryParamsAdd.value.parentdistrictList = arr;
  AssessDistrictName.value = getDistrict(arr);
  districtListName.value = getProvinces(AssessDistrictName.value);
}

/** 获取列表操作 */
function getList() {
  if (activeName.value == "first") {
    //地图查询全部任务
    //getAllList();
  } else {
    loading.value = true;
    getAssess(queryParams.value).then((response) => {
      listData.value = response.data.rows;
      loading.value = false;
      total.value = response.data.total;
    }).catch((error) => {
      loading.value = false;
      listData.value = [];
      total.value = 0;
    });
  }
}

//地图查询全部任务
function getAllList() {
  loading.value = true;
  completeRefreshAssess.value = true;//防止地图刷新后不显示--
  //地图查询全部任务
  getAllAssessList().then((response) => {
    nextTick(() => {
      allListData.value = response.data;
      //completeRefreshAssess.value = true;//防止地图刷新后不显示--
      loading.value = false;
    });
  });
}


/** 删除按钮操作 */
function handleDelete() {
  //if (delFlag.value) {
  proxy.$modal
    .confirm("请确认是否要删除选择的评估结果？")
    .then(function () {
      return delAssess(ids.value);
    })
    .then(() => {
      getList();
      proxy.$modal.msgSuccess("删除成功");
    })
    .catch(() => { });
  //} else {
  //  //proxy.$modal.msgWarning("审核、结束状态的任务不可删除");
  //}
}

// 打开行政选区
function areaSelect() {
  openArea.value = true;
  resetArea();
}
// 选择关闭后的回调
function closeSelect() {
  openArea.value = false;
  resetArea();
}
function resetArea() {
  selectArea.value = [];
  proxy.resetForm("rulesForm");
}
// 新建任务
function add() {
  proxy.$modal.loading("正在查询，请稍候...");
  districtBoundaryList.value = [];//行政区划经纬度信息
  //查询行政区划经纬度信息
  //地图获取行政区划总面积
  //let area = getAllSelectArea(queryParamsAdd.value.parentdistrictList);
  //queryParamsAdd.value.AssessArea = area.toString();
  //根据所有省市县全名字符串获取codelist
  let codeList = getCodeByAllName(AssessDistrictName.value);
  //选择的行政区划数量
  districtCount.value = codeList.length;
  let regionCodes = "";
  for (let i = 0; i < codeList.length; i++) {
    let code = codeList[i];
    if (i > 0) {
      regionCodes += ",";
    }
    regionCodes += code;
  }
  resetAdd();
  queryParamsAdd.value.regionCodes = regionCodes;//地图行政区划code,code字符串
  //查询行政区划经纬度信息
  getDistrictBoundaryByCode(codeList);
  /*//新建任务
  proxy.$refs["rulesForm"].validate((vaild) => {
    if (!vaild) {
      return;
    }
    //resetAdd();
    getAssessNum();
    subAssessData.value = [];
    title.value = "新建任务";
    num.value = 0;
    openAdd.value = true;
    //地图获取行政区划总面积
    let area = getAllSelectArea(queryParamsAdd.value.parentdistrictList);
    queryParamsAdd.value.AssessArea = area.toString();
    proxy.$modal.closeLoading();
  });*/
}

// 新建子任务
function addSub(row) {
  numAdd.value = 1;
  resetSubData();
  getSubAssessNum(row.AssessNum);
  parentAssessCode.value = row.AssessNum;
  parentAssessYear.value = row.AssessYear;
  parentAssessId.value = row.id;
  districtListName.value = getProvinces(row.AssessDistrict);
  queryParamsAdd.value.parentdistrictList = row.AssessDistrict.split('、');
  //任务区域
  queryParamsAdd.value.AssessRegion = row.AssessRegion;
  if (queryParamsAdd.value.AssessRegion.indexOf("MULTIPOLYGON") == -1) {//地图绘制区域
  } else {
    //根据所有省市县全名字符串获取codelist
    let codeList = getCodeByAllName(row.AssessDistrict);
    //选择的行政区划数量
    districtCount.value = codeList.length;
    let regionCodes = "";
    for (let i = 0; i < codeList.length; i++) {
      let code = codeList[i];
      if (i > 0) {
        regionCodes += ",";
      }
      regionCodes += code;
    }
    //父任务行政区划code,code字符串
    queryParamsAdd.value.regionCodes = regionCodes;//地图行政区划code,code字符串
  }
  titleSub.value = "新建子任务";
  num.value = 2;
  openAddSub.value = true;
}

// 新建子任务
function addSub2(row) {
  proxy.$refs["rulesFormAdd"].validate((vaild) => {
    if (!vaild) {
      return;
    }
    resetSubData();
    getSubAssessNum(row.AssessNum);
    titleSub.value = "新建子任务";
    num.value = 2;
    openAddSub.value = true;
    parentAssessCode.value = row.AssessNum;
    parentAssessYear.value = row.AssessYear;
  });
}

/** 查看按钮操作 */
function handleDetil(id) {
  title.value = "查看任务";
  openAdd.value = true;
  dzhpIsEdit.value = true;
  styhIsEdit.value = true;
  rtzxIsEdit.value = true;
  detailAssess({ dtId: id }).then((response) => {
    queryParamsAdd.value = response.data;
    if (response.data.disasterType != "" || response.data.disasterType != null) {
      queryParamsAdd.value.disasterType = response.data.disasterType.split(",");
    } else {
      queryParamsAdd.value.disasterType = [];
    }
  });
}

// 修改任务
function update(row) {
  title.value = "修改任务";
  dzhpIsEdit.value = false;
  styhIsEdit.value = false;
  rtzxIsEdit.value = false;
  detailAssess({ dtId: row.dtId }).then((response) => {
    queryParamsAdd.value = response.data;
    if (response.data.disasterType != "" || response.data.disasterType != null) {
      queryParamsAdd.value.disasterType = response.data.disasterType.split(",");
    } else {
      queryParamsAdd.value.disasterType = [];
    }
    openAdd.value = true;
  });
}

// 改变年份
function changeYear(val){
  getAssessNum(val)
}
// 获取任务编码
function getAssessNum(AssessYear) {
  getAssessBian({ AssessYear: AssessYear }).then((response) => {
    nextTick(() => {
      queryParamsAdd.value.AssessNum = response.data;
    });
  });
  return queryParamsAdd.value.AssessNum;
}

// 获取子任务编码
function getSubAssessNum(AssessNum) {
  getSubAssessBian({ AssessNum: AssessNum }).then((response) => {
    nextTick(() => {
      queryParamsSubAdd.value.AssessNum = response.data;
    });
  });
  return queryParamsAdd.value.AssessNum;
}

/** 提交按钮 */
function okAdd() {
  proxy.$refs["rulesFormAdd"].validate((vaild) => {
    if (!vaild) {
      return;
    }
    //截取数据防止报错--仅用于展示不保存
    let subStr = queryParamsAdd.value.AssessRegion;
    subStr = subStr.substring(0, 10000);
    queryParamsAdd.value.AssessRegion = subStr;
    queryParamsAdd.value.disasterType = queryParamsAdd.value.disasterType.join(",");
    // 修改
    updateAssess(queryParamsAdd.value).then((response) => {
      openAdd.value = false;
      proxy.$modal.msgSuccess("修改成功");
      resetAdd();
      getList();
    });
  });
}
function resetAdd() {
  queryParamsAdd.value.AssessNum = "";
  queryParamsAdd.value.AssessName = "";
  queryParamsAdd.value.AssessArea = "";
  queryParamsAdd.value.AssessRegion = "";
  queryParamsAdd.value.AssessDistrict = "";
  proxy.resetForm("rulesFormAdd");
}
// 取消
function cancelAdd() {
  openAdd.value = false;
  resetAdd();
}

function closeAdd() {
  openAdd.value = false;
  resetAdd();
  openArea.value = false;
  resetArea();
}
/** 提交按钮 */
function okSubAdd() {
  // 新增
  if (titleSub.value == "新建子任务") {
    //获取新建子任务地图区域信息
    getSubAssessMapRegion("okSubAdd");
  } else {
    proxy.$refs["rulesFormSubAdd"].validate((vaild) => {
      if (!vaild) {
        return;
      }
      if (queryGroupObj.value) {
        queryParamsSubAdd.value.groupName = queryGroupObj.value.groupName;
        queryParamsSubAdd.value.groupLeader = queryGroupObj.value.groupLeader;
        queryParamsSubAdd.value.groupId = queryGroupObj.value.id;
        queryParamsSubAdd.value.groupLeaderId = queryGroupObj.value.groupLeaderId;
      }
      //截取数据防止报错--仅用于展示不保存
      let subStr = queryParamsSubAdd.value.AssessRegion;
      subStr = subStr.substring(0, 10000);
      queryParamsSubAdd.value.AssessRegion = subStr;
      // 修改
      updateAssess(queryParamsSubAdd.value).then((response) => {
        openAddSub.value = false;
        proxy.$modal.msgSuccess("修改成功");
        getSubList(parentAssessId.value);
        getList();
        resetSubData();
      });
    });
  }
  /* proxy.$refs["rulesFormSubAdd"].validate((vaild) => {
     if (!vaild) {
       return;
     }
     if (queryGroupObj.value) {
       queryParamsSubAdd.value.groupName = queryGroupObj.value.groupName;
       queryParamsSubAdd.value.groupLeader = queryGroupObj.value.groupLeader;
       queryParamsSubAdd.value.groupId = queryGroupObj.value.id;
       queryParamsSubAdd.value.groupLeaderId = queryGroupObj.value.groupLeaderId;
     }
     // 新增
     if (titleSub.value == "新建子任务") {
       if (numAdd.value == 1) {
         addSubAssess({
           ...queryParamsSubAdd.value,
           subdistrictList: [queryParamsSubAdd.value.subdistrictList],
           AssessYear: parentAssessYear.value,
           parentAssess: parentAssessCode.value,
           parentId: parentAssessId.value,
           parentdistrictList:queryParamsAdd.value.parentdistrictList,
         }).then((response) => {
           openAddSub.value = false;
           proxy.$modal.msgSuccess(response.data.message);
           resetSubData();
           getList();
           queryGroupObj.value = undefined;
           getSubList(parentAssessId.value);
         });
       } else {
         addAssess({
           parentAssess: queryParamsAdd.value,
           subAssess: {
             ...queryParamsSubAdd.value,
             subdistrictList: [queryParamsSubAdd.value.subdistrictList],
             AssessYear: parentAssessYear.value,
             parentAssess: parentAssessCode.value,
           },
         }).then((response) => {
           proxy.$modal.msgSuccess("保存成功");
           numAdd.value = 1;
           openAddSub.value = false;
           resetSubData();
           getSubList(response.data.parentAssessId);
           queryGroupObj.value = undefined;
           parentAssessId.value = response.data.parentAssessId;
           //地图传参
           isSaveMapPolygon.value = true;
         });
       }
     } else {
       // 修改
       updateAssess(queryParamsSubAdd.value).then((response) => {
         openAddSub.value = false;
         proxy.$modal.msgSuccess("修改成功");
         getSubList(parentAssessId.value);
         getList();
         resetSubData();
       });
     }
   });*/
}

function okSubAddNext() {
  //获取新建子任务地图区域信息
  getSubAssessMapRegion("okSubAddNext");
  /*proxy.$refs["rulesFormSubAdd"].validate((vaild) => {
    if (!vaild) {
      return;
    }
    // 新增
    if (queryGroupObj.value) {
      queryParamsSubAdd.value.groupName = queryGroupObj.value.groupName;
      queryParamsSubAdd.value.groupLeader = queryGroupObj.value.groupLeader;
      queryParamsSubAdd.value.groupId = queryGroupObj.value.id;
      queryParamsSubAdd.value.groupLeaderId = queryGroupObj.value.groupLeaderId;
    }
    if (numAdd.value == 1) {
      addSubAssess({
        ...queryParamsSubAdd.value,
        subdistrictList: [queryParamsSubAdd.value.subdistrictList],
        AssessYear: parentAssessYear.value,
        parentAssess: parentAssessCode.value,
        parentId: parentAssessId.value,
        parentdistrictList:queryParamsAdd.value.parentdistrictList,
      }).then((response) => {
        proxy.$modal.msgSuccess("保存成功");
        getSubAssessNum(parentAssessCode.value);
        resetSubData();
        getList();
        queryGroupObj.value = undefined;
        getSubList(parentAssessId.value);
      });
    } else {
      addAssess({
        parentAssess: queryParamsAdd.value,
        subAssess: {
          ...queryParamsSubAdd.value,
          subdistrictList: [queryParamsSubAdd.value.subdistrictList],
          AssessYear: parentAssessYear.value,
          parentAssess: parentAssessCode.value,
        },
      }).then((response) => {
        proxy.$modal.msgSuccess("保存成功");
        numAdd.value = 1;
        getSubAssessNum(parentAssessCode.value);
        resetSubData();
        // rulesFormSubAdd.value.clearValidate();
        getSubList(response.data.parentAssessId);
        queryGroupObj.value = undefined;
        parentAssessId.value = response.data.parentAssessId;
        //地图传参
        isSaveMapPolygon.value = true;
      });
    }
  });*/
}
function resetSubData() {
  queryParamsSubAdd.value.AssessYear = "";
  queryParamsSubAdd.value.AssessNum = "";
  queryParamsSubAdd.value.AssessName = "";
  queryParamsSubAdd.value.AssessArea = "";
  queryParamsSubAdd.value.AssessRegion = "";
  queryParamsSubAdd.value.subdistrictList = "";
  (queryParamsSubAdd.value.AssessDistrict = ""),
    (queryParamsSubAdd.value.groupName = "");
  queryParamsSubAdd.value.groupLeader = "";
  queryParamsSubAdd.value.groupLeaderId = "";
  queryParamsSubAdd.value.groupId = "";
  proxy.resetForm("rulesFormSubAdd");
}
// 取消新建子任务
function cancelAddSub() {
  openAddSub.value = false;
  getSubList(parentAssessId.value);
}

getYear();
getList();
getProvinceData();
//getTreeselect();

//查看详情地图页面
const showDetailMap = (row) => {
  let num = row.num;
  let faultVersion = row.faultVersion;
  //评估记录是否生成过评估结果
  hasEvaluateResult(row.dsrId).then(response => {
    router.push({
      path: "ruptureZoneAssessDetailMap",
      query: {
        num: num,
        faultVersion: faultVersion,//断层版本号
        longitude: row.longitude,//经度
        latitude: row.latitude,//纬度
        earthQuakeLevel: row.earthQuakeLevel,//震级
        sourceDepth: row.sourceDepth,//震源深度(km)
        faultProperties: row.faultProperties,//断层性质
        metaTitle: "查看地表破裂带评估结果",
        ruptureLength:row.ruptureLength,
        displacement:row.displacement
      }
    });
  }).catch(() => { });
}

onMounted(() => {
  completeRefreshAssess.value = true;
})
</script>
<style scoped lang="scss">
.area span.label {
  text-align: right;
  margin-right: 14px;
  display: inline-block;
  color: #606266;
  font-weight: 700;
  width: 30px;
}

.smallHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: #1890ff;
  position: relative;
  color: #fff;
  font-weight: 700;
}

.addAssess,
.addSubAssess {
  width: 700px;
  margin: 0 auto;

  td {
    width: 350px;
  }

  .label {
    text-align: right;
    display: inline-block;
    color: #606266;
    font-weight: 700;
    height: 32px;
    width: 142px;
    padding-right: 14px;
  }
}

h3 {
  color: #333;
  height: 21px;
  font-size: 16px;
  line-height: 21px;
  display: flex;
  align-items: center;
  margin-left: 40px;

  span {
    margin-right: 12px;
    display: inline-block;
    width: 3px;
    height: 16px;
    background: #333;
  }
}

.areaDialog {
  text-align: center;

  .close {
    text-align: right;

    .el-icon {
      color: #606266;
      padding: 20px 0;
      margin-right: 10px;
      right: 0px;
      font-size: 22px;
    }
  }

  width: 320px;
  position: absolute;
  top: 270px;
  left: 320px;
  background: rgba($color: #fff, $alpha: 0.9);
}
</style>
